/**
 *
 */
package cn.edu.cqupt.cyExam.service;



import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;


import cn.edu.cqupt.cyExam.myBatis.bean.User;
import cn.edu.cqupt.cyExam.myBatis.dao.UserMapper;

/**
 * @author asus
 *
 */
@Service("userService")
public class UserService {
@Resource

private UserMapper userMapper;


/*	public String getUsersNameById(Integer usersId)
	{

		return usersMapper.getUsersNameById(usersId);
	}*/
public int CheckAcount(String usersAccountnumber) {
	User user = userMapper.selectUsersByUsersAccountnumber(usersAccountnumber);
	if (user!=null){
		return 1;
	}else {
		return 0;
	}

}

//删除用户
	public int deleteUser(String user_name){
		return userMapper.deletUser(user_name);
	}

//检查邮箱惟一
		public int CheckEmail(String usersEmail) {
			if(userMapper.CheckEmail(usersEmail) >= 1){
				return 1;
			}else {
				return 0;
			}

		}
		//添加用户
				public int InsertUsers(User users) {
					return userMapper.insertUsers(users);
				}

				//通过用户名获取用户
				public User getUsersAccountnumber(String usersAccountnumber) {
					return userMapper.selectUsersByUsersAccountnumber(usersAccountnumber);
				}
				//通过邮箱更改密码
				public void updatepasswordByeMail(String MailPasswordByMD5,String account) {
					userMapper.updatepasswordByeMail(MailPasswordByMD5,account);
				}







}
